package com.example.contestsystem.Controller;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping
public class GeneralController {
    /**
     * 此方法实现学生和教师的登出
     */
    @GetMapping("/logout")
    public String logout(HttpServletRequest httpServletRequest){
        httpServletRequest.getSession().setAttribute("loginStu", null);
        httpServletRequest.getSession().setAttribute("loginTeacher", null);
        return "redirect:/contest";
    }
}
